<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<h:head>
	<title>Aggiungi Nuovo Pacchetto</title>
</h:head>
<h:body>

	<ui:composition template="../template.xhtml">
		<ui:define name="menu">

			<h:form prependId="false">
				<p:menu id="leftIm">

					<p:submenu label="Area Impiegato">
						<p:menuitem value="Admin" outcome="index" icon="ui-icon-home" />
						<p:menuitem value="Mezzi" outcome="showEditMezzo"
							icon="ui-icon-star" />
						<p:menuitem value="Escursioni" outcome="showEditEscursione"
							icon="ui-icon-star" />
						<p:menuitem value="Alberghi" outcome="showEditAlbergo"
							icon="ui-icon-star" />
						<p:menuitem value="Luoghi" outcome="luoghiLis" icon="ui-icon-star" />
						<p:menuitem value="New Pacchetto" outcome="AddPacchetto"
							icon="ui-icon-star" />
						<p:menuitem value="Logout" action="#{logoutBean.logout()}"
							icon="ui-icon-close" />
					</p:submenu>
				</p:menu>
			</h:form>
		</ui:define>
		<ui:define name="content">
			<h:form id="form" prependId="false">
				<p:panel header="AddPack Form">
					<h:panelGrid columns="2" id="regGrid">

						<h:outputLabel>Luogo Partenza</h:outputLabel>

						<p:selectOneMenu value="#{addPackBean.par}">
							<f:selectItems value="#{addPackBean.luogoLis}" var="LuogoDTO"
								itemValue="#{LuogoDTO.id}" itemLabel="#{LuogoDTO.citta}" />

						</p:selectOneMenu>
						<h:outputLabel></h:outputLabel>
						<h:outputLabel></h:outputLabel>
						<h:outputLabel>Luogo Destinazione</h:outputLabel>

						<p:selectOneMenu value="#{addPackBean.dest}">
							<f:selectItems value="#{addPackBean.luogoLis}" var="LuogoDTO"
								itemValue="#{LuogoDTO.id}" itemLabel="#{LuogoDTO.citta}" />

						</p:selectOneMenu>

						<h:outputText value="Data Partenza:" />
						<p:calendar value="#{addPackBean.dataA}" id="popupCal1" />
						<h:outputText value="#{addPackBean.dataA}" id="popupDate1">
							<f:convertDateTime pattern="d/M/yyyy" />
						</h:outputText>

						<h:outputLabel></h:outputLabel>

						<h:outputText value="Data Ritorno :" />
						<p:calendar value="#{addPackBean.dataP}" id="popupCal" />
						<h:outputText value="#{addPackBean.dataP}" id="popupDate">
							<f:convertDateTime pattern="d/M/yyyy" />
						</h:outputText>

						<h:outputLabel></h:outputLabel>

						<p:commandButton value="Find" update="regGrid"
							action="#{addPackBean.findAll()}" />

						<h:outputLabel></h:outputLabel>

					
						<h:outputLabel>Mezzo Andata</h:outputLabel>

						<p:selectOneMenu value="#{addPackBean.mezzoA}">
							<f:selectItems value="#{addPackBean.mezziLisAnd}" var="MezzoDTO"
								itemValue="#{MezzoDTO.id}" itemLabel="#{MezzoDTO.dataInizio}" />

						</p:selectOneMenu>

						<h:outputLabel>Mezzo Ritorno</h:outputLabel>

						<p:selectOneMenu value="#{addPackBean.mezzoB}">
							<f:selectItems value="#{addPackBean.mezziLisRit}" var="MezzoDTO1"
								itemValue="#{MezzoDTO1.id}" itemLabel="#{MezzoDTO1.dataInizio}" />

						</p:selectOneMenu>

						

						<h:outputLabel for="Hotel">Hotel:</h:outputLabel>
						<h:selectOneMenu for="Hotel" value="#{addPackBean.hotel}">
							<f:selectItems id="Hotel" value="#{addPackBean.albergoLis}"
								var="AlbergoDTO" itemValue="#{AlbergoDTO.id}"
								itemLabel="#{AlbergoDTO.nome}" />
						</h:selectOneMenu>
						<p:message for="Hotel" />

						<h:outputLabel></h:outputLabel>
						<h:outputLabel for="Escursion">Escursioni:</h:outputLabel>
						<f:facet name="header">Clicca su view per vedere i dettagli</f:facet>
						<p:dataTable id="Escursion" var="esc"
							value="#{addPackBean.esclis}" rowKey="#{esc.id}"
							selection="#{addPackBean.escScelte}" selectionMode="multiple">
							<p:column headerText="Id">  #{esc.id}  </p:column>

							<p:column headerText="Costo">  #{esc.costoPerEsc}  </p:column>

							<p:column headerText="Data Iniziale">  #{esc.dataInizio}  </p:column>

							<p:column headerText="Data Fine">  #{esc.dataFine}  </p:column>

							<f:facet name="footer">
								<p:commandButton value="View" icon="ui-icon-search"
									update=":form:display"
									oncomplete="PF('escursionDialog').show()" />
							</f:facet>
						</p:dataTable>
						<p:dialog header="Escursion Detail" widgetVar="escursionDialog"
							width="250" showEffect="explode" hideEffect="explode">

							<p:dataList id="display" value="#{addPackBean.escScelte}"
								var="selectedEsc" type="definition">  
  
            										ID: #{selectedEsc.id}, Descrizione: #{selectedEsc.infoEsc}   
             							</p:dataList>

						</p:dialog>
						<p:commandButton value="Add" action="#{addPackBean.add()}" />
					</h:panelGrid>


				</p:panel>

			</h:form>
		</ui:define>

	</ui:composition>
	
</h:body>
</html>